﻿package mortal.game.view.copy.sunbathCopy.view
{
    import com.gengine.global.*;
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import extend.language.*;
    import fl.data.*;
    import flash.events.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.sunbathCopy.render.*;
    import mortal.mvc.interfaces.*;

    public class SunbathDanceListPanel extends BaseWindow
    {
        protected var _list:GTileList;
        protected var _cbtn:GButton;
        private static var _instance:SunbathDanceListPanel;

        public function SunbathDanceListPanel(param1:ILayer = null)
        {
            this.setSize(350, 250);
            super(param1);
            this.layer = LayerManager.uiLayer;
            this.title = "" + Language.getString(70975);
            this._tweenable = false;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._list = UIFactory.tileList(36, 46, 295, 126, this);
            this._list.direction = GBoxDirection.VERTICAL;
            this._list.verticalGap = 2;
            this._list.horizontalGap = 2;
            this._list.rowHeight = 61;
            this._list.columnWidth = 280;
            this._list.columnCount = 1;
            this._list.rowCount = 3;
            this._list.width = 295;
            this._list.setStyle("cellRenderer", SunbathDanceCell);
            this._cbtn = UIFactory.gButton("" + Language.getString(70976), 146, 200, 50, 30, this);
            this._cbtn.configEventListener(MouseEvent.CLICK, this.onCk);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._list = null;
            this._cbtn = null;
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show(param1, param2);
            this.stageResize();
            return;
        }// end function

        override public function stageResize() : void
        {
            super.stageResize();
            x = Global.stage.stageWidth - this.width >> 1;
            y = Global.stage.stageHeight - this.height >> 1;
            return;
        }// end function

        public function updateList(param1:Array) : void
        {
            if (isDisposed)
            {
                return;
            }
            this._list.dataProvider = new DataProvider(param1);
            this.changeHei(param1);
            return;
        }// end function

        private function onCk(event:MouseEvent) : void
        {
            this.hide();
            return;
        }// end function

        private function changeHei(param1:Array) : void
        {
            var _loc_2:int = 0;
            if (param1 == null)
            {
                this.height = 140;
                this._cbtn.y = 65;
            }
            else
            {
                _loc_2 = param1.length;
                _loc_2 = _loc_2 > 3 ? (3) : (_loc_2);
                this.height = 100 + _loc_2 * 61;
                this._cbtn.y = 56 + _loc_2 * 61;
            }
            return;
        }// end function

        public static function get instance() : SunbathDanceListPanel
        {
            if (_instance == null)
            {
                _instance = new SunbathDanceListPanel;
            }
            return _instance;
        }// end function

        public static function get hasInstance() : Boolean
        {
            return _instance != null;
        }// end function

    }
}
